import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
const router = new Router({
    routes: [
        {
            path: '/',
            name: 'layout',
            redirect: '/about',
            component: () => import('./views/Layout.vue'),
            children:[
                {
                    path: '/about',
                    name: 'about',
                    component: () => import('./views/About.vue')
                },
                {
                    path: '/researchDevelopment',
                    name: 'researchDevelopment',
                    component: () => import('./views/ResearchDevelopment.vue')
                },
                {
                    path: '/productServices',
                    name: 'productServices',
                    component: () => import('./views/ProductServices.vue')
                },
                {
                    path: '/quality',
                    name: 'quality',
                    component: () => import('./views/Quality.vue')
                },
                {
                    path: '/news',
                    name: 'news',
                    component: () => import('./views/News.vue')
                },
                {
                    path: '/contact',
                    name: 'contact',
                    component: () => import('./views/Contact.vue')
                },
            ]
        },
        {
            path: '*',
            redirect: '/about'
        }
    ],
    scrollBehavior (to, from, savedPosition) {
        if (savedPosition) {
            return savedPosition
        } else {
            return { x: 0, y: 0 }
        }
    }
})

export default router
